package net.wanho.shop.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import net.wanho.shop.service.ReportService;
import net.wanho.shop.vo.AjaxResult;
import net.wanho.shop.vo.OrderStatusVo;
import net.wanho.shop.vo.PayMethodVo;
import net.wanho.shop.vo.ReportVo;
import net.wanho.shop.vo.TopTenVo;
import net.wanho.shop.vo.TurnoverVo;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 这个类是：
 *
 * @author: MENG HU WANG
 * @date: 2024/12/31 0:44
 * @version: 1.0
 */


@Api(tags = "11.数据统计")
@RestController
@RequestMapping("/reports")
@RequiredArgsConstructor
public class ReportController {

    private final ReportService reportService;

    @ApiOperation("实时数据统计")
    @GetMapping("live")
    public AjaxResult live() {
        ReportVo reportVo = reportService.live();
        return AjaxResult.success(reportVo);
    }

    @ApiOperation("营业额统计")
    @GetMapping("turnover")
    public AjaxResult turnover() {
        TurnoverVo turnoverVo = reportService.getTurnover();
        return AjaxResult.success(turnoverVo);
    }

    @ApiOperation("订单状态统计")
    @GetMapping("orderStatus")
    public AjaxResult orderStatus() {
        OrderStatusVo orderStatusVo = reportService.getOrderStatus();
        return AjaxResult.success(orderStatusVo);
    }

    @ApiOperation("分类销量排名top10")
    @GetMapping("top10")
    public AjaxResult topTen() {
        TopTenVo topTenVo = reportService.getTopTen();
        return AjaxResult.success(topTenVo);
    }


    @ApiOperation("支付方式统计")
    @GetMapping("payMethod")
    public AjaxResult payMethod() {
        PayMethodVo payMethod = reportService.getPayMethod();
        return AjaxResult.success(payMethod);
    }
}
